package com.tuoyu.peopletest.view.ac;

import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;

import com.blankj.utilcode.util.BarUtils;
import com.tuoyu.peopletest.R;
import com.tuoyu.peopletest.utils.SCUIUtils;

import androidx.appcompat.app.AppCompatActivity;


public class SplashActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        if (!isTaskRoot()
                && getIntent().hasCategory(Intent.CATEGORY_LAUNCHER)
                && getIntent().getAction() != null
                && getIntent().getAction().equals(Intent.ACTION_MAIN)) {
            finish();
            return;
        } else {
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
                requestWindowFeature(Window.FEATURE_NO_TITLE);// 隐藏标题栏
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);// 隐藏状态栏
            }
            BarUtils.setStatusBarColor(this.getWindow(), SCUIUtils.getColor(R.color.sc_c_transparent));
            setContentView(R.layout.activity_splash);
        }
        SCUIUtils.getMainThreadHandler().postDelayed(() -> {
            startActivity(new Intent(SplashActivity.this, StartActivity.class));
            finish();
        }, 1000);
    }
}
